<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>样式绑定</title>
    <script src="./vue.js"></script>
    <style>
        .activated {
            color: red;
        }
    </style>
</head>
<body>
<div id="app">
    <!--:class="{activated:isActivated}" 绑定activated样式 是否使用activated样式取决于isActivated的值-->
    <div @click="handleDivClick" :class="{activated:isActivated}">Style Bind</div>
</div>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            isActivated: false
        },
        methods: {
            handleDivClick: function () {
                this.isActivated = !this.isActivated;
            }
        }
    });
</script>
</body>
</html>